package com.kuanter.kuanterauto.activity;


import android.location.Location;

import com.baidu.mapapi.map.LocationData;
import com.kuanter.kuanterauto.entity.SiteInfo;

public class TestData {
	
	public void setDistance(LocationData data, double latitude,double longtitude,SiteInfo site) {
		float[] distance = new float[1];
		Location.distanceBetween(data.latitude, data.longitude, latitude, longtitude, distance);
		int m = (int) distance[0];
		
		if(m > 1000) {
			float km = (float)m / 1000;
			float b = (float)(Math.round(km*10))/10;  //10表示小数点后一位 
			site.setSiteDistance(b + "KM");
		} else {
			site.setSiteDistance(m + "m");
		}
	}
}
